﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using GameSDK.Board;
using CounterGame.Player;
using GameSDK.Events;

namespace CounterGame.Board
{
    public class CounterBoard : StdBoard
    {
        public event PlayerMovedEventHandler PlayerMove;

        #region Attributes

        public const int VALEUR_MAX = 1000000;

        private int _currentVal;
        public int CurrentVal {
            get { return this._currentVal; }
            set { this._currentVal = value; }
        }
        #endregion

        #region Constructor

        public CounterBoard()
            : base()
        {
            _currentVal = 0;
        }

        #endregion

        #region Methods
        public void startGame()
        {
            if (ListPlayer == null)
            {
                Console.WriteLine("We need player!!");
            }
            else if (ListPlayer.Count != 2)
            {
                Console.WriteLine("We need 2 players !!");
            }
            else
            {
                ListPlayer[0].NextMove();
            }
        }

        public void AddPlayer(CounterPlayer player)
        {
            ListPlayer.Add(player);
            player.GamePlayerId = ListPlayer.Count;
            player.Board = this;
        }
        #endregion

        public override void PlayerMoved(GameSDK.Player.StdPlayer player, GameSDK.Player.StdMove move)
        {
            if (PlayerMove != null)
            {
                PlayerMove(this, new MoveEventArgs(this, player, move));
            }
    }
    }
}
